package model.service;

public class Customer {
	
	public static final int PERSON = 1;
	public static final int ENTERPRISE = 2;
	private Person person;
	private Enterprise enterprise;
	private int customer;
	
	public Customer(int subjectFk) {
		this.customer = subjectFk;
	}
	public Customer(int customerId, Person personByCustomerId) {
		this.customer = customerId;
		this.setPerson(personByCustomerId);
	}
	public Customer(int customer, Enterprise enterprise){
		this.customer = customer;
		this.setEnterprise(enterprise);
	}
	public Customer() {
		// TODO Auto-generated constructor stub
	}
	public void setEnterprise(Enterprise enterprise) {
		this.enterprise = enterprise;
		this.person = null;
	}
	public Enterprise getEnterprise() {
		return enterprise;
	}
	public void setPerson(Person person) {
		this.person = person;
		this.enterprise = null;
	}
	public Person getPerson() {
		return person;
	}
	
	public boolean isPerson(){
		if(person != null){
			return true;
		}
		else{
			return false;
		}
	}
	public void setCustomer(int customer) {
		this.customer = customer;
	}
	public int getCustomer() {
		return customer;
	}
	public String getCustomerName() {
		String name = null;
		if(person != null){
			name = person.getFirstName()+" "+person.getLastName();
		}
		else if(enterprise != null){
			name = enterprise.getName();
		}
		return name;
	}

}
